<extend name="./app/Tpl/Public/template.html" />
<block name="content_body">
	<div class="pad-lr-10">
	    <div style="padding:10px; overflow:hidden;">
	    	<div class="main_top" style="clear:both;"><h4>温馨提示：</h4>
    			<ul>
    				<li class="green">1.广告</li>
    			</ul>
	    	</div>
	    </div>
	    <form name="form_edit" id="form_edit" action="{:U('doUpd')}" method="post">
	    	<input type="hidden" name="id" id="id" class="input-text-long" value="{$detail.id}">
	        <table width="100%" cellpadding="2" cellspacing="1" class="table_form">
	            <tr>
	                <th width="100"><span class="required">*</span>广告类型:</th>
	                <td width="300">
	                	<input type="radio" name="type" value="pc" <if condition="$detail['type'] eq 'pc'">checked</if> >PC端
	                	<input type="radio" name="type" value="mobile" <if condition="$detail['type'] eq 'mobile'">checked</if>>手机端
	                </td>
	                <td><div id="typeTip"></div></td>
	            </tr>
	            <tr>
	                <th width="100"><span class="required">*</span>广告位置:</th>
	                <td width="300">
						<select name="page_id" style="width:250px;"  class="chosen_search">
							<optgroup label="PC端">
							<volist name="typeList.pc" id="val">
               					<option value="{$key}" <if condition="$detail['page_id'] eq $key">selected</if>>{$val}</option>
               				</volist>
               				</optgroup>
               				<optgroup label="Mobile端">
               				<volist name="typeList.mobile" id="val">
               					<option value="{$key}"  <if condition="$detail['page_id'] eq $key">selected</if>>{$val}</option>
               				</volist>
               				</optgroup>
						</select>
	                </td>
	                <td><div id="page_idTip"></div></td>
	            </tr>
	            <tr>
	                <th><span class="required">*</span>图片外链:</th>
	                <td>
	                	<input type="text" name="pic" id="pic" class="input-text-long" value="{$detail.pic}">
	                </td>
	                <td><div id="picTip"></div></td>
	            </tr>	            
	            <tr>
	                <th><span class="required">*</span>链接地址:</th>
	                <td>
	                	<input type="text" name="link" id="link" class="input-text-long" value="{$detail.link}">
	                </td>
	                <td><div id="linkTip"></div></td>
	            </tr>
	            <tr>
	                <th><span class="required">*</span>引用参数:</th>
	                <td>
	                	<input type="text" name="page_ref" id="page_ref" class="input-text-long" value="{$detail.page_ref}">
	                </td>
	                <td><div id="page_refTip"></div></td>
	            </tr>	            
	            <tr>
	                <th>广告标题:</th>
	                <td>
	                	<input type="text" name="title" id="title" class="input-text-long" value="{$detail.title}">
	                </td>
	                <td><div id="titleTip"></div></td>
	            </tr>
	            <tr>
	                <th>广告说明:</th>
	                <td>
	                	<textarea name="content" id="content" cols="30" rows="3">{$detail.content}</textarea>
	                </td>
	                <td><div id="contentTip"></div></td>
	            </tr>
				<tr>
		            <td colspan="3">
			            <div class="explain-col">
			            	<input type="button" name="submitBtn" value="修改" onclick="doSubmit()">
	        				<input type="button" name="reset" value="返回列表" onclick='redirect("{:U('index')}")'>
			        	</div>
		            </td>
	            </tr>
	        </table>

	    </form>
	</div>
	<div id="dialog_content" title="弹出框"></div>
<script type="text/javascript">
function doSubmit(){
	$('#form_edit').submit();
}
$(function(){
	
	$.formValidator.initConfig({
		formID:"form_edit",
		wideWord:false,
		submitOnce:true
	});
	var tips = {
		"typeTip":"请选择广告类型",
		"picTip":"请输入图片地址",
		"page_refTip":"请输入页面引用参数"
	}
	$("#pic").formValidator({
		onFocus:tips.picTip
	}).inputValidator({
		min:1,
		onError:"图片地址不能为空"
	});
	$("#page_ref").formValidator({
		onFocus:tips.page_refTip
	}).inputValidator({
		min:1,
		onError:"页面引用参数不能为空"
	});
})

</script>
</block>	